var MyData;
$(function(){
    $('#b_reset').click(function(){
        location.reload();
    });
    $('#b_cancel').click(function(){
        location.href = "../";
    });
    $('#b_save').click(function(){
        $('#mFrom').submit();
    });


    $('#mFrom').validate({
        rules:{
            quartzJobname:"required",
            quartzCronexp:"required",
            quartzJoburl:"required"
        },
        messages:{
            quartzJobname:"请填写任务名称",
            quartzCronexp:"请填写cron表达式",
            quartzJoburl:"请填写任务url"
        },
        submitHandler: function() {
            var MyUrl="saveQuartz.do";
            $.post(MyUrl,$("#mFrom").serialize(),function(d){
                MyData= $.parseJSON(d);
                if(MyData.success){
                    layer.alert(MyData.success,function(){
                        location.href = "../";
                    });
                } else {
                    layer.alert(MyData.error);
                }
            });
        }
    });

});
